package com.example.lab4.Controller;

import com.example.lab4.Entity.乘客;
import com.example.lab4.Mapper.乘客Dao;
import com.example.lab4.common.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Controller
public class IndexController {
    @Autowired
    private 乘客Dao 乘客dao;

    @RequestMapping("/")
    public String GotoLogin(){
        return "Index";
    }

    @RequestMapping("/index")
    public String GotoIndex(){
        return "Index";
    }

    @PostMapping("/login")
    @ResponseBody
    public Result login(@RequestBody 乘客 一个乘客){
        乘客 该乘客 = 乘客dao.search(一个乘客);
        return Result.ok(该乘客);
    }
}
